Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

megacmd: add ffmpeg and freeimage support; add darwin support #362308

Merged
merged 3 commits into from
Jan 4, 2025

Conversation

UlyssesZh
Copy link
Member

@UlyssesZh UlyssesZh commented Dec 6, 2024

Add FFmpeg support via a patch. Add FreeImage support optionally (user can risk the insecurity by overriding an argument). Add Darwin support.

Closes #297586.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@UlyssesZh UlyssesZh marked this pull request as draft December 6, 2024 05:09
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Dec 6, 2024
@UlyssesZh UlyssesZh added the 6.topic: darwin Running or building packages on Darwin label Dec 6, 2024
@ofborg ofborg bot added the 8.has: package (new) This PR adds a new package label Dec 6, 2024
@ofborg ofborg bot requested a review from lunik1 December 6, 2024 22:57
@ofborg ofborg bot added 11.by: package-maintainer This PR was created by the maintainer of the package it changes 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1 and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin labels Dec 6, 2024
@lunik1
Copy link
Contributor

lunik1 commented Dec 10, 2024

Do we know exactly what features including ffmpeg and freeimage enables?

@UlyssesZh
Copy link
Member Author

FFmpeg is for video preview/thumbnail generation, and FreeImage is for image preview/thumbnail generation. Don't know how these features are relevant to a CLI app but there they are.

@UlyssesZh
Copy link
Member Author

In file included from ./include/mega/types.h:45,
                 from ./include/mega/proxy.h:25,
                 from ./include/mega/osx/osxutils.h:4,
                 from src/osx/osxutils.mm:1:
./include/mega/posix/megasys.h:116:10: fatal error: curl/curl.h: No such file or directory
  116 | #include <curl/curl.h>
      |          ^~~~~~~~~~~~~
compilation terminated.

This is truly curious. Help needed.

@OPNA2608
Copy link
Contributor

OPNA2608 commented Dec 13, 2024

Is forcing GCC instead of Clang necessary to fix something or demanded by upstream, or would using the default be fine?

The following builds just fine with the regular stdenv for me:

diff --git a/pkgs/by-name/me/megacmd/fix-darwin.patch b/pkgs/by-name/me/megacmd/fix-darwin.patch
index 12f0733f91a1..e46d8d99b9b4 100644
--- a/pkgs/by-name/me/megacmd/fix-darwin.patch
+++ b/pkgs/by-name/me/megacmd/fix-darwin.patch
@@ -6,7 +6,7 @@
  
 +if DARWIN
 +AM_LIBTOOLFLAGS="--tag=CXX"
-+AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/osx
++AM_CPPFLAGS+=-I$(top_srcdir)/sdk/include/mega/osx -I$(top_srcdir)/include/mega/osx
 +endif
 +
  if WIN32
@@ -25,7 +25,7 @@
  
 +if DARWIN
 +AM_LIBTOOLFLAGS="--tag=CXX"
-+AM_CPPFLAGS+=-I$(top_srcdir)/include/mega/osx
++AM_CPPFLAGS+=-I$(top_srcdir)/sdk/include/mega/osx -I$(top_srcdir)/include/mega/osx
 +endif
 +
  if WIN32
diff --git a/pkgs/by-name/me/megacmd/package.nix b/pkgs/by-name/me/megacmd/package.nix
index 53a5159e7cc8..59acd25766d1 100644
--- a/pkgs/by-name/me/megacmd/package.nix
+++ b/pkgs/by-name/me/megacmd/package.nix
@@ -8,7 +8,6 @@
   fetchFromGitHub,
   ffmpeg,
   freeimage,
-  gcc-unwrapped,
   icu,
   libmediainfo,
   libraw,
@@ -19,7 +18,6 @@
   pkg-config,
   readline,
   sqlite,
-  darwin,
   withFreeImage ? false, # default to false because freeimage is insecure
 }:
 
@@ -58,10 +56,9 @@ stdenv.mkDerivation {
     [
       c-ares
       cryptopp
-      curl.dev
+      curl
       ffmpeg
       icu
-      gcc-unwrapped
       libmediainfo
       libraw
       libsodium
@@ -72,16 +69,7 @@ stdenv.mkDerivation {
       sqlite
     ]
     ++ lib.optionals withFreeImage [ freeimage ]
-    ++ lib.optionals stdenv.isDarwin (
-      with darwin.apple_sdk.frameworks;
-      [
-        CoreFoundation
-        CoreServices
-        SystemConfiguration
-        Cocoa
-        DiskArbitration
-      ]
-    );
+    ;
 
   configureFlags = [
     "--disable-curl-checks"

@UlyssesZh
Copy link
Member Author

Thank you @OPNA2608. I got it working.

It seems that gcc-unwrapped is needed on Linux.

@UlyssesZh UlyssesZh marked this pull request as ready for review December 13, 2024 19:52
Copy link
Member

@donovanglover donovanglover left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@donovanglover donovanglover added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Dec 30, 2024
@wegank wegank added 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package 12.approvals: 2 This PR was reviewed and approved by two reputable people and removed 12.approvals: 1 This PR was reviewed and approved by one reputable person labels Jan 2, 2025
@wegank
Copy link
Member

wegank commented Jan 4, 2025

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 362308


aarch64-darwin

✅ 1 package built:
  • megacmd

@wegank wegank merged commit 8185920 into NixOS:master Jan 4, 2025
56 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: darwin Running or building packages on Darwin 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 10.rebuild-darwin: 1 10.rebuild-linux: 1-10 10.rebuild-linux: 1 11.by: package-maintainer This PR was created by the maintainer of the package it changes 12.approvals: 2 This PR was reviewed and approved by two reputable people 12.approved-by: package-maintainer This PR was reviewed and approved by a maintainer listed in the package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package request: megacmd for darwin
5 participants